#include "StdAfx.h"
#include "SceneNode.h"
#include "SceneManager.h"

VAMPIRE_NAMESPACE_BEGIN

void SceneNode::attachObject( MovableObject* obj )
{
	mObjectMap[obj->getName()] = obj;
	obj->setAttachedNode(this);
}

SceneNode* SceneNode::createChildSceneNode( const TString& name, const Vector3& translate /*= Vector3::ZERO*/, const Quaternion& rotate /*= Quaternion::IDENTITY*/ )
{
	SceneNode* node = VAMPIRE_NEW SceneNode(mpCreator, name);
	node->setParent(this);
	node->setWorldSpacePosition(translate);
	node->setWorldSpaceOrientation(rotate);
	mChildren[name] = node;
	
	mpCreator->addSceneNode(node);

	return node;
}

VAMPIRE_NAMESPACE_END